package com.huishu.tcm.service.serviceImpl;

import com.huishu.tcm.entity.PopularScience;
import com.huishu.tcm.mapper.PopularScienceMapper;
import com.huishu.tcm.service.PopularScienceService;
import org.springframework.stereotype.Service;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

@Service
public class PopularScienceServiceImpl extends ServiceImpl<PopularScienceMapper, PopularScience> implements PopularScienceService {

	 /**
     * 筛选条件
     * @param v
     * @return
     */
    @Override
    public QueryWrapper<PopularScience> getQueryWrapper(PopularScience v){
        QueryWrapper<PopularScience> queryWrapper = new QueryWrapper<>();
        queryWrapper.orderByDesc("create_time");
        if(ObjectUtil.isEmpty(v)){
            return queryWrapper;
        }
		if(ObjectUtil.isNotEmpty(v.getId())){
        	queryWrapper.eq("id", v.getId());
        }
       	return queryWrapper;
    }
}